if (mainctx)
g_main_context_pop_thread_default (mainctx);
g_clear_object (&request.metalink);
+ g_clear_pointer (&request.verification_sha256, g_free);
+ g_clear_pointer (&request.verification_sha512, g_free);
+ g_clear_pointer (&request.last_metalink_error, g_free);
g_clear_pointer (&request.urls, g_ptr_array_unref);
g_clear_pointer (&request.parser, g_markup_parse_context_free);
return ret;
ret = TRUE;
out:
if (a)
- (void)archive_read_close (a);
+ {
+ (void)archive_read_close (a);
+ (void)archive_read_free (a);
+ }
return ret;
#else
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt",
remote_name);
- jar_path = g_build_filename (g_file_get_path (self->repodir), cookie_file,
+ jar_path = g_build_filename (gs_file_get_path_cached (self->repodir), cookie_file,
NULL);
if (g_file_test(jar_path, G_FILE_TEST_IS_REGULAR))
GError **error)
{
gboolean ret = FALSE;
- char **lines = NULL;
+ g_auto(GStrv) lines = NULL;
g_autofree char *contents = NULL;
SoupURI *mirrorlist = NULL;
g_autoptr(GPtrArray) ret_mirrorlist =
const char *dir_to_pull = NULL;
g_autofree char **dirs_to_pull = NULL;
g_autofree char **refs_to_fetch = NULL;
- char **override_commit_ids = NULL;
+ g_autofree char **override_commit_ids = NULL;
GSource *update_timeout = NULL;
gboolean disable_static_deltas = FALSE;
gboolean require_static_deltas = FALSE;
{
gboolean ret = FALSE;
g_autoptr(GHashTable) ret_modified_regfile_content =
- g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_ptr_array_unref);
+ g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
g_autoptr(GPtrArray) from_sizes = NULL;
g_autoptr(GPtrArray) to_sizes = NULL;
guint i, j;
OT_VARIANT_MAP_TRUSTED, &delta_superblock, error))
goto out;
- g_print ("%s\n", g_variant_print (delta_superblock, 1));
+ { g_autofree char *variant_string = g_variant_print (delta_superblock, 1);
+ g_print ("%s\n", variant_string);
+ }
g_print ("Delta: %s\n", delta_id);
{ const char *endianness_description;
g_autoptr(GFileInputStream) filein = NULL;
g_autoptr(GDataInputStream) datain = NULL;
gboolean enabled = FALSE;
- char *policytype = NULL;
+ g_autofree char *policytype = NULL;
const char *selinux_prefix = "SELINUX=";
const char *selinuxtype_prefix = "SELINUXTYPE=";
goto out;
}
- self->selinux_policy_name = g_strdup (policytype);
+ self->selinux_policy_name = g_steal_pointer (&policytype);
self->selinux_policy_root = g_object_ref (etc_selinux_dir);
}
if (freed_space > 0)
{
- char *freed_space_str = g_format_size_full (freed_space, 0);
+ g_autofree char *freed_space_str = g_format_size_full (freed_space, 0);
g_print ("Freed objects: %s\n", freed_space_str);
}
csum = g_key_file_get_string (self->origin, "origin", "override-commit", NULL);
if (csum != NULL && !ostree_validate_checksum_string (csum, error))
goto out;
+ g_clear_pointer (&self->override_csum, g_free);
self->override_csum = g_steal_pointer (&csum);
ret = TRUE;
g_autoptr(GFile) subtree = NULL;
g_autofree char *commit = NULL;
g_autoptr(GVariant) commit_data = NULL;
- struct archive *a;
+ struct archive *a = NULL;
OstreeRepoExportArchiveOptions opts = { 0, };
context = g_option_context_new ("COMMIT - Stream COMMIT to stdout in tar format");
ret = TRUE;
out:
+#ifdef HAVE_LIBARCHIVE
+ if (a)
+ archive_write_free (a);
+#endif
if (context)
g_option_context_free (context);
return ret;
if (opt_add_tombstones)
{
GError *local_error = NULL;
- const char *parent = ostree_commit_get_parent (commit);
+ g_autofree char *parent = ostree_commit_get_parent (commit);
if (parent)
{
g_autoptr(GVariant) parent_commit = NULL;
value = argv[5];
cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name);
- jar_path = g_build_filename (g_file_get_path (repo->repodir), cookie_file, NULL);
+ jar_path = g_build_filename (gs_file_get_path_cached (repo->repodir), cookie_file, NULL);
jar = soup_cookie_jar_text_new (jar_path, FALSE);
/* jar takes ownership of cookie */
soup_cookie_jar_add_cookie (jar, cookie);
+ if (context)
+ g_option_context_free (context);
return TRUE;
}
cookie_name = argv[4];
cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name);
- jar_path = g_build_filename (g_file_get_path (repo->repodir), cookie_file, NULL);
+ jar_path = g_build_filename (gs_file_get_path_cached (repo->repodir), cookie_file, NULL);
jar = soup_cookie_jar_text_new (jar_path, FALSE);
cookies = soup_cookie_jar_all_cookies (jar);
if (!found)
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Cookie not found in jar");
+ if (context)
+ g_option_context_free (context);
return found;
}